<template>
  <views class="member_list">
    <viewTitle :title="'寄件人员列表'"></viewTitle>
    <div class="search">
      <el-form ref="form" label-width="auto" :inline="true">
        <el-form-item label="所属企业:">
          <el-input type="text" clearable placeholder="请输入姓名" v-model="member_name"></el-input>
        </el-form-item>
        <el-form-item label="联系电话:">
          <el-input type="text" clearable placeholder="请输入联系电话" v-model="member_mobile"></el-input>
        </el-form-item>
        <el-form-item label="身份证号:">
          <el-input type="text" clearable placeholder="请输入身份证号" v-model="card_no"></el-input>
        </el-form-item>
      </el-form>

      <div class="btn-area">
        <el-button type="primary" @click="getData">查询</el-button>
        <el-button @click="reset">重置</el-button>
      </div>
    </div>
    <div class="table_list">
      <el-table :data="tableList" style="width: 100%" border :header-cell-style="getRowClass">
        <el-table-column type="index" label="序号" width="100"></el-table-column>
        <el-table-column prop="member_name" label="人员姓名" width="180"></el-table-column>
        <el-table-column prop="member_mobile" label="联系电话" width="200"></el-table-column>
        <el-table-column prop="card_no" label="身份证号" width="300"></el-table-column>
        <el-table-column :formatter="(row)=>{return this.$moment(row.post_time*1000).format('YYYY-MM-DD HH:mm:ss')}" label="最近托运时间" width="auto"></el-table-column>
        <el-table-column fixed="right" label="操作" width="150">
          <template slot-scope="scope">
            <el-button type="success" v-if="$route.query.check.q" @click="toDetail(scope.row)">详情</el-button>
          </template>
        </el-table-column>
      </el-table>
      <div class="flex flexR paging">
        <el-pagination
          style="background:#fff; padding:10px 0"
          background
          layout="prev, pager, next,sizes,total, jumper"
          @size-change="(page_size) => {this.pagination.page_size = page_size;this.getData()}"
          @current-change="(page_start) => {this.pagination.page_start = page_start;this.getData()}"
          :page-sizes="[10, 20, 30, 50]"
          :page-size="pagination.page_size"
          :total="pagination.total_count"
          :current-page="pagination.current_page"
          :page-count="pagination.page_count"
        ></el-pagination>
      </div>
    </div>
  </views>
</template>


<script>
export default {
  data() {
    return {
      member_name: "", // 编入时间
      member_mobile: "", // 发布人
      card_no: "", // 内容名称
      tableList: [],
      pagination: {
        page_start: 0, //搜索开始页码
        current_page: 0, //当前页码
        page_count: 0, //总页数
        page_size: 10, //每页数量
        total_count: 0 //总数量
      }
    };
  },
  methods: {
    //    修改第一行样式
    getRowClass({ row, column, rowIndex, columnIndex }) {
      if (rowIndex === 0) {
        return "background: #FAFAFA ";
      } else {
        return "";
      }
    },
    //    修改是否换行
    changeStyleRow(width) {
      let _width = width - 290 - 350 - 300 - 50 - 25;
      if (_width > 300) {
        this.marginLeft = 25;
      } else {
        this.marginLeft = 0;
      }
    },
    // 获取数据
    getData() {
          this.$raxios.post(
            this.$mapapi.admin_memberList,
              {data:this.post_data}
        ).then(res=>{
              if(res.code==200){
              this.tableList = res.data.list;
              this.pagination = res.data.pagination;
              }else{
              this.tableList = [];
              this.pagination = [];
	              this.$message.error(res.msg)
              return;
              }
            }).catch(res=>{

            })   
    },
    // 去详情
    toDetail(row) {
      this.$toRoutePath({
        path: "/member_list/member_list_detail",
        edit: true,
        query: { type: 1,member_id:row.member_id }
      });
    },
    // 重置
    reset() {
	    this.member_name = '';
	    this.member_mobile = '';
	    this.card_no = '';
	    this.pagination = '';
	    this.getData();
    }
  },
  computed:{
      post_data(){
          let data = {};
          data.member_name = this.member_name;
          data.member_mobile = this.member_mobile;
          data.card_no = this.card_no;
          data.pagination = this.pagination;
          return data
      }
  },
  mounted() {
      this.getData()
  },
  created() {}
};
</script>





<style lang="less" :scope="true"  src="@/style/personnel_manager/member_list.less">
</style>
